

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>4.2. Common functions for topology building — MDAnalysis.topology.core &mdash; MDAnalysis v0.7.5-devel documentation</title>
    <link rel="stylesheet" href="../../_static/sphinxdoc.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '0.7.5-devel',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within MDAnalysis v0.7.5-devel documentation"
          href="../../_static/opensearch.xml"/>
    <link rel="shortcut icon" href="../../_static/mdanalysis-logo.ico"/>
    <link rel="top" title="MDAnalysis v0.7.5-devel documentation" href="../../index.html" />
    <link rel="up" title="4. Topology modules" href="../topology_modules.html" />
    <link rel="next" title="4.3. MDAnalysis topology tables" href="tables.html" />
    <link rel="prev" title="4.1. Topology readers — MDAnalysis.topology" href="init.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="tables.html" title="4.3. MDAnalysis topology tables"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="init.html" title="4.1. Topology readers — MDAnalysis.topology"
             accesskey="P">previous</a> |</li>
        <li><a href="../../index.html">MDAnalysis v0.7.5-devel documentation</a> &raquo;</li>
          <li><a href="../topology_modules.html" accesskey="U">4. Topology modules</a> &raquo;</li> 
      </ul>
    </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/mdanalysis-logo-200x150.png" alt="Logo"/>
            </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="init.html"
                        title="previous chapter">4.1. Topology readers &#8212; <tt class="docutils literal"><span class="pre">MDAnalysis.topology</span></tt></a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="tables.html"
                        title="next chapter">4.3. MDAnalysis topology tables</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/documentation_pages/topology/core.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <span class="target" id="module-MDAnalysis.topology.core"></span><div class="section" id="common-functions-for-topology-building-mdanalysis-topology-core">
<h1>4.2. Common functions for topology building &#8212; <a class="reference internal" href="#module-MDAnalysis.topology.core" title="MDAnalysis.topology.core"><tt class="xref py py-mod docutils literal"><span class="pre">MDAnalysis.topology.core</span></tt></a><a class="headerlink" href="#common-functions-for-topology-building-mdanalysis-topology-core" title="Permalink to this headline">¶</a></h1>
<p>The various topology parsers make use of functions and classes in this
module. They are mostly of use to developers.</p>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="tables.html#module-MDAnalysis.topology.tables" title="MDAnalysis.topology.tables"><tt class="xref py py-mod docutils literal"><span class="pre">MDAnalysis.topology.tables</span></tt></a> for some hard-coded atom
information that is used by functions such as <a class="reference internal" href="#MDAnalysis.topology.core.guess_atom_type" title="MDAnalysis.topology.core.guess_atom_type"><tt class="xref py py-func docutils literal"><span class="pre">guess_atom_type()</span></tt></a> and
<a class="reference internal" href="#MDAnalysis.topology.core.guess_atom_mass" title="MDAnalysis.topology.core.guess_atom_mass"><tt class="xref py py-func docutils literal"><span class="pre">guess_atom_mass()</span></tt></a>.</p>
</div>
<dl class="class">
<dt id="MDAnalysis.topology.core.Bond">
<em class="property">class </em><tt class="descclassname">MDAnalysis.topology.core.</tt><tt class="descname">Bond</tt><big>(</big><em>a1</em>, <em>a2</em><big>)</big><a class="headerlink" href="#MDAnalysis.topology.core.Bond" title="Permalink to this definition">¶</a></dt>
<dd><p>A bond between two <a class="reference internal" href="../core/AtomGroup.html#MDAnalysis.core.AtomGroup.Atom" title="MDAnalysis.core.AtomGroup.Atom"><tt class="xref py py-class docutils literal"><span class="pre">Atom</span></tt></a> instances.</p>
<dl class="method">
<dt id="MDAnalysis.topology.core.Bond.length">
<tt class="descname">length</tt><big>(</big><big>)</big><a class="headerlink" href="#MDAnalysis.topology.core.Bond.length" title="Permalink to this definition">¶</a></dt>
<dd><p>Length of the bond.</p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="MDAnalysis.topology.core.build_bondlists">
<tt class="descclassname">MDAnalysis.topology.core.</tt><tt class="descname">build_bondlists</tt><big>(</big><em>atoms</em>, <em>bonds</em><big>)</big><a class="headerlink" href="#MDAnalysis.topology.core.build_bondlists" title="Permalink to this definition">¶</a></dt>
<dd><p>Construct the bond list of each <a class="reference internal" href="../core/AtomGroup.html#MDAnalysis.core.AtomGroup.Atom" title="MDAnalysis.core.AtomGroup.Atom"><tt class="xref py py-class docutils literal"><span class="pre">Atom</span></tt></a>.</p>
<p>The bond list is stored in the attribute
<tt class="xref py py-attr docutils literal"><span class="pre">MDAnalysis.core.AtomGroup.Atom.bonds</span></tt> and consists of a list of
<a class="reference internal" href="#MDAnalysis.topology.core.Bond" title="MDAnalysis.topology.core.Bond"><tt class="xref py py-class docutils literal"><span class="pre">Bond</span></tt></a> instances.</p>
</dd></dl>

<dl class="function">
<dt id="MDAnalysis.topology.core.build_segments">
<tt class="descclassname">MDAnalysis.topology.core.</tt><tt class="descname">build_segments</tt><big>(</big><em>atoms</em><big>)</big><a class="headerlink" href="#MDAnalysis.topology.core.build_segments" title="Permalink to this definition">¶</a></dt>
<dd><p>Create all <a class="reference internal" href="../core/AtomGroup.html#MDAnalysis.core.AtomGroup.Segment" title="MDAnalysis.core.AtomGroup.Segment"><tt class="xref py py-class docutils literal"><span class="pre">Segment</span></tt></a> instancess from a list of <a class="reference internal" href="../core/AtomGroup.html#MDAnalysis.core.AtomGroup.Atom" title="MDAnalysis.core.AtomGroup.Atom"><tt class="xref py py-class docutils literal"><span class="pre">Atom</span></tt></a> instances.</p>
<p>The function also builds the <a class="reference internal" href="../core/AtomGroup.html#MDAnalysis.core.AtomGroup.Residue" title="MDAnalysis.core.AtomGroup.Residue"><tt class="xref py py-class docutils literal"><span class="pre">Residue</span></tt></a>
instances by tracking residue numbers.</p>
</dd></dl>

<dl class="function">
<dt id="MDAnalysis.topology.core.get_atom_mass">
<tt class="descclassname">MDAnalysis.topology.core.</tt><tt class="descname">get_atom_mass</tt><big>(</big><em>element</em><big>)</big><a class="headerlink" href="#MDAnalysis.topology.core.get_atom_mass" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the atomic mass in u for <em>element</em>.</p>
<p>Masses are looked up in <a class="reference internal" href="tables.html#MDAnalysis.topology.tables.masses" title="MDAnalysis.topology.tables.masses"><tt class="xref py py-data docutils literal"><span class="pre">MDAnalysis.topology.tables.masses</span></tt></a>.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Unknown masses are set to 0.</p>
</div>
</dd></dl>

<dl class="function">
<dt id="MDAnalysis.topology.core.get_parser_for">
<tt class="descclassname">MDAnalysis.topology.core.</tt><tt class="descname">get_parser_for</tt><big>(</big><em>filename</em>, <em>permissive=False</em>, <em>format=None</em><big>)</big><a class="headerlink" href="#MDAnalysis.topology.core.get_parser_for" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the appropriate topology parser for <em>filename</em>.</p>
<p>Automatic detection is disabled when an explicit <em>format</em> is
provided.</p>
</dd></dl>

<dl class="function">
<dt id="MDAnalysis.topology.core.guess_atom_charge">
<tt class="descclassname">MDAnalysis.topology.core.</tt><tt class="descname">guess_atom_charge</tt><big>(</big><em>atomname</em><big>)</big><a class="headerlink" href="#MDAnalysis.topology.core.guess_atom_charge" title="Permalink to this definition">¶</a></dt>
<dd><p>Guess atom charge from the name.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Not implemented; simply returns 0.</p>
</div>
</dd></dl>

<dl class="function">
<dt id="MDAnalysis.topology.core.guess_atom_element">
<tt class="descclassname">MDAnalysis.topology.core.</tt><tt class="descname">guess_atom_element</tt><big>(</big><em>atomname</em><big>)</big><a class="headerlink" href="#MDAnalysis.topology.core.guess_atom_element" title="Permalink to this definition">¶</a></dt>
<dd><p>Guess the element of the atom from the name.</p>
<p>Looks in dict to see if element is found, otherwise it uses the first character in the atomname.
The table comes from CHARMM and AMBER atom types, where the first character is not sufficient to
determine the atom type. Some GROMOS ions have also been added.</p>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="#MDAnalysis.topology.core.guess_atom_type" title="MDAnalysis.topology.core.guess_atom_type"><tt class="xref py py-func docutils literal"><span class="pre">guess_atom_type()</span></tt></a> and
<a class="reference internal" href="tables.html#module-MDAnalysis.topology.tables" title="MDAnalysis.topology.tables"><tt class="xref py py-mod docutils literal"><span class="pre">MDAnalysis.topology.tables</span></tt></a> (where the data are stored)</p>
</div>
</dd></dl>

<dl class="function">
<dt id="MDAnalysis.topology.core.guess_atom_mass">
<tt class="descclassname">MDAnalysis.topology.core.</tt><tt class="descname">guess_atom_mass</tt><big>(</big><em>atomname</em><big>)</big><a class="headerlink" href="#MDAnalysis.topology.core.guess_atom_mass" title="Permalink to this definition">¶</a></dt>
<dd><p>Guess a mass based on the atom name.</p>
<p><a class="reference internal" href="#MDAnalysis.topology.core.guess_atom_element" title="MDAnalysis.topology.core.guess_atom_element"><tt class="xref py py-func docutils literal"><span class="pre">guess_atom_element()</span></tt></a> is used to determine the kind of atom.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Anything not recognized is simply set to 0; if you rely on the
masses you might want to double check.</p>
</div>
</dd></dl>

<dl class="function">
<dt id="MDAnalysis.topology.core.guess_atom_type">
<tt class="descclassname">MDAnalysis.topology.core.</tt><tt class="descname">guess_atom_type</tt><big>(</big><em>atomname</em><big>)</big><a class="headerlink" href="#MDAnalysis.topology.core.guess_atom_type" title="Permalink to this definition">¶</a></dt>
<dd><p>Guess atom type from the name.</p>
<p>At the moment, this function simply returns the element, as
guessed by <a class="reference internal" href="#MDAnalysis.topology.core.guess_atom_element" title="MDAnalysis.topology.core.guess_atom_element"><tt class="xref py py-func docutils literal"><span class="pre">guess_atom_element()</span></tt></a>.</p>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="#MDAnalysis.topology.core.guess_atom_element" title="MDAnalysis.topology.core.guess_atom_element"><tt class="xref py py-func docutils literal"><span class="pre">guess_atom_element()</span></tt></a> and <a class="reference internal" href="tables.html#module-MDAnalysis.topology.tables" title="MDAnalysis.topology.tables"><tt class="xref py py-mod docutils literal"><span class="pre">MDAnalysis.topology.tables</span></tt></a></p>
</div>
</dd></dl>

<dl class="function">
<dt id="MDAnalysis.topology.core.guess_format">
<tt class="descclassname">MDAnalysis.topology.core.</tt><tt class="descname">guess_format</tt><big>(</big><em>filename</em>, <em>format=None</em><big>)</big><a class="headerlink" href="#MDAnalysis.topology.core.guess_format" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the type of topology file <em>filename</em>.</p>
<p>The current heuristic simply looks at the filename extension but
more complicated probes could be implemented here or in the
individual packages (e.g. as static methods).</p>
<p>If <em>format</em> is supplied then it overrides the auto detection.</p>
</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="tables.html" title="4.3. MDAnalysis topology tables"
             >next</a> |</li>
        <li class="right" >
          <a href="init.html" title="4.1. Topology readers — MDAnalysis.topology"
             >previous</a> |</li>
        <li><a href="../../index.html">MDAnalysis v0.7.5-devel documentation</a> &raquo;</li>
          <li><a href="../topology_modules.html" >4. Topology modules</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2005-2011, Naveen Michaud-Agrawal, Elizabeth J. Denning, Joshua Adelman,
    Christian Beckstein (logo), David Caplan, Jan Domański, Philip Fowler,
    Joseph Goose, Benjamin Hall, Danny Parton, Tyler Reddy, Paul Rigor,
    and Oliver Beckstein.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>